<template>

	<el-card shadow="never" header="操作日志" class="logs_card">
		<div class="search_wrap">
			<scSearch @upsearch="upsearch" >
				<template #item>
				<el-form-item label="关键字：">
					<el-input v-model="search.keyword" placeholder="关键字" @keyup.enter="upsearch" clearable></el-input>
				</el-form-item>
				</template>
			</scSearch>
		</div>
		<el-main class="logs_main">
		<scTable ref="table" :apiObj="apiObj" :params="search" row-key="id" @selection-change="selectionChange" stripe remoteSort>
			<sc-table-column label="序号" type="index"></sc-table-column>
			<sc-table-column label="日志类型" prop="operationRecordTypeText" ></sc-table-column>
			<sc-table-column label="业务名称" prop="name" width="200"></sc-table-column>
			<sc-table-column label="业务描述" prop="desc" min-width="300"></sc-table-column>
			<sc-table-column label="创建人" prop="createdAtUserName" ></sc-table-column>
			<sc-table-column label="创建日期" prop="createdAt" sortable='custom' width="130">
				<template #default="scope">
						<span>{{this.$TOOL.dateFormat(scope.row.createdAt)}}</span>
				</template>
			</sc-table-column>
			<sc-table-column label="操作状态" prop="statusText">
				<template #default="scope">
						<el-tag :type="scope.row.statusText == '成功' ? 'success' : 'danger'">{{scope.row.statusText}}</el-tag>
				</template>
			</sc-table-column>
			<sc-table-column label="用户操作ip" prop="ip" width="120"></sc-table-column>
		</scTable>
		</el-main>

	</el-card>

</template>

<script>
	export default {
		data() {
			return {
				apiObj: this.$API.common.logsList,
				search: {
					keyword: '',
				},
				data: [
					{
						title: "修改用户 lolowan",
						ip: "211.187.11.18",
						code: "成功",
						time: "2022-10-10 08:41:17"
					},
					{
						title: "用户登录",
						ip: "211.187.11.18",
						code: "成功",
						time: "2022-10-10 08:21:51"
					}
				]
			}
		},
		mounted() {

		},
		methods: {
			//搜索
			upsearch(type){
				let search = this.search
				if(type == 'clear') {
					search.keyword = ''
				}
				this.$refs.table.upData(search)
			},
		},
	}
</script>

<style lang="scss" scoped>
.logs_card {
	height: 100% !important;
}
::v-deep .el-card__body {
	height: 100%;
	display: flex;
    flex-direction: column;
}
.search_wrap {
	height: auto;
}
.el-main.nopadding {
	padding: auto 0  !important;
}
.logs_main {
	padding-left: 0;
	padding-right: 0;
}

</style>
